/**
 * @author Aleksandr Smirnov (luc@hot.ee)
 */

function out(s, color) {
	document.write("<span style='color: "+(color || "black")+"'>"+s+"</span><br>");
}

function test(p, t) {
	try {
		var res = eval(p);
	} catch(err) {
		out(p+" => "+(err.description ? err.description : err), "red");
		return;
	}
	
	if(res&&res.inspect) res = res.inspect();
	
	if(typeof(t) != 'undefined') {
		if(t.inspect) t = t.inspect();
		
		if(res==t)
			out(p+" => "+res, "green");
		else 
			out(p+" => "+res+" should be "+t, "red");
	} else {
		if(res)
			out(p+" => "+res);
		else
			out(p);
	}
}

function title(s) {
	document.write("<p><u>"+s+"</u></p>");
}
